package com.stx.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.mindrot.jbcrypt.BCrypt;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;
@Data
@TableName("r_judge")
public class Judge {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;//用户id
    //@Pattern(regexp = "^[a-zA-Z0-9]{4,10}$",message = "用户名格式不正确")
    @NotEmpty(message = "用户名不能为空")
    private String judUsername;//用户名
    //@Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[A-Za-z\\d_]{4,12}$",message = "密码格式不正确")
    @NotEmpty(message = "密码不能为空")
    private String judPassword;//密码
    @NotEmpty(message = "姓名不能够为空")
    private String judName;//姓名
    //@NotEmpty(message = "角色不能够为空")。@NotEmpty 通常用于检查字符串、集合、映射（Map）、数组等是否为空,不适合Integer
    @NotNull
    private Integer judRole;//角色
    @NotNull
    private Integer judState;//状态
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime judDate;//创建时间
    @TableField(exist = false)//不映射数据库
    private String token;
    @TableField(exist = false)
    private Integer total;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public @NotEmpty(message = "用户名不能为空") String getJudUsername() {
        return judUsername;
    }

    public void setJudUsername(@NotEmpty(message = "用户名不能为空") String judUsername) {
        this.judUsername = judUsername;
    }

    public @NotEmpty(message = "密码不能为空") String getJudPassword() {
        return judPassword;
    }

    public void setJudPassword(@NotEmpty(message = "密码不能为空") String judPassword) {
        this.judPassword = judPassword;
    }

    public @NotEmpty(message = "姓名不能够为空") String getJudName() {
        return judName;
    }

    public void setJudName(@NotEmpty(message = "姓名不能够为空") String judName) {
        this.judName = judName;
    }

    public @NotNull Integer getJudRole() {
        return judRole;
    }

    public void setJudRole(@NotNull Integer judRole) {
        this.judRole = judRole;
    }

    public @NotNull Integer getJudState() {
        return judState;
    }

    public void setJudState(@NotNull Integer judState) {
        this.judState = judState;
    }

    public LocalDateTime getJudDate() {
        return judDate;
    }

    public void setJudDate(LocalDateTime judDate) {
        this.judDate = judDate;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return "Judge{" +
                "id=" + id +
                ", judUsername='" + judUsername + '\'' +
                ", judPassword='" + judPassword + '\'' +
                ", judName='" + judName + '\'' +
                ", judRole=" + judRole +
                ", judState=" + judState +
                ", judDate=" + judDate +
                ", token='" + token + '\'' +
                ", total=" + total +
                '}';
    }
}
